package main;

import java.awt.*;
import java.util.Random;

/**
 * 所有类的资源数据
 *
 * @author fdh
 */
public class Resource {
    public static class LoginFrameResource {
        // 文本
        public static String titleTxt = "登录";
        public static String welcomeTxt = "欢迎使用此管理系统";
        public static String usernameTxt = "用户名";
        public static String passwordTxt = "密码";
        public static String rePasswordTxt = "确认密码";
        public static String loginBtnTxt = "登录";
        public static String registerBtnTxt = "注册";
        public static String authorTxt = "by fdh / 图片素材来源于网络";
        //错误提醒
        public static String rePasswordError = "输入密码不一致";
        public static String haveNotEnableChar = "包含非法字符,密码和用户名只能由数字、字母、下划线组成";
        public static String remindTxt = "注意:密码和用户名只能由数字、字母、下划线组成";
        public static String loginError = "用户名或密码错误";
        public static String infoLengthError = "用户名和密码长度必须大于等于6且小于等于15";
        //字体
        public static String songTiTxtFontFamily = "宋体";
        public static String msYaHeiTxtFontFontFamily = "微软雅黑";
        //文本长度
        public static int[] usernameLength = {6, 15};
        public static int[] passwordLength = {6, 15};
        // 窗口及其子组件设置
        public static Dimension frameSize = new Dimension(900, 600);
        public static Point imgPanelPos = new Point(0, 0);
        public static int offsetPos = 30;
        // public static Dimension imgPanelSize = new Dimension(400, 500);
        // public static Point loginPanelPos = new Point(400, 0);
        // public static Dimension loginPanelSize = new Dimension(300, 500);

        // 窗口占比
        public static double imgPanelRatio = 0.65;
        public static double loginPanelRatio = 0.35;
        // 外部文件
        public static String[] allLoginImgSrc = new String[]{
                "src/resource/img/img_1.jpg",
                "src/resource/img/img_2.jpg",
                "src/resource/img/img_3.jpg",
                "src/resource/img/img_4.jpg",
                "src/resource/img/img_5.jpg"
        };
        public static String currentLoginImgSrc = allLoginImgSrc[new Random().nextInt(allLoginImgSrc.length)];
        public static String userInfoSrc = "src/resource/datas/userInfo.fdhdata";
    }

    public static class IndexFrameResource {
        //文本
        public static String title = "索引页";
        public static String createTableTxt = "创建表格";
        public static String checkTableTxt = "查看表格";
        public static String delTableTxt = "删除表格";
        public static String searchTableDataTxt = "查找数据";
        public static String footerLabelRemindTxt = "表格操作,保存后同步到日志库:" + "'" + MyLog.logPath + "'";
        public static String searchDataDialogRemind = "多条件查询可以用','隔开";
        //窗口及其子组件设置
        public static Dimension frameSize = new Dimension(950, 650);
        public static Point leftPanelPos = new Point(0, 0);
        public static Dimension createTableDialogSize = new Dimension(300, 200);
        public static Dimension checkTableDialogSize = new Dimension(300, 200);
        public static Dimension delTableDialogSize = new Dimension(300, 200);
        public static Dimension searchTableDataDialogSize = new Dimension(400, 300);
        public static int searchTableDataDialogResultMaxLength = 20;
        //swing也太难用了,各种莫名其妙的问题,烦死我了,写完我直接烧高香
        /*
            ###
            #X#
            ##V
            写代码不如玩井字棋
         */
        //因为残影bug,猜测是渲染问题,目前无解决方案,所以弃用
//        public static Color leftPanelBackgroundColor = new Color(79, 79, 76, 90);
//        public static Color rightPanelBackgroundColor = new Color(176, 159, 246, 124);
        //窗口占比
        public static double leftRatio = 0.7;
        public static double rightRatio = 0.3;
    }

    /**
     * 数据文件标记,必须以***_start:开始和***_end结尾
     */
    public static class DataFile {
        //一定要以'/'结尾
        public static String dataPath = "src/resource/datas/";

        /**
         * 标识符
         */
        public static class Maker {
            public static String start = "_start";
            public static String end = "_end";
            public static String suffixName = "fdhdata";
        }

        public static class UserInfo {
            public static String userInfoStart = "userInfo_start:";
            public static String userInfoEnd = "userInfo_end";
        }
    }

    /**
     * 我的日志文件
     */
    public static class MyLog {
        public static String logPath = "src/resource/log/tablelog/";

        public static class Maker {
            public static String suffixName = "fdhlog";
            public static String remindLineMaker = "注意:"; //特别提醒信息
        }
    }

    public static class Tables {
        //一定要以'/'结尾
        public static String tablesPath = "src/resource/tables/";

        public static class TablesMakers {
            public static String columnStart = "column_start:";
            public static String columnEnd = "column_end";
            public static String rowStart = "row_start:";
            public static String rowEnd = "row_end";
            public static String splitChar = "|";
            public static String suffixName = "fdhtb";
        }
    }

    /**
     * 杂物图片
     */
    public static class OtherImg {
        public static String butterfly = "src/resource/img/img_butterfly.png";
        public static String whale = "src/resource/img/img_whale.png";
        public static String backgroundImg = "src/resource/img/img_background1.jpg";
        public static String whale2 = "src/resource/img/img_whale2.png";
    }

    /**
     * 全局配置类
     */
    public static class Config {
        //MouseMoveAnim
        public static String mouseMoveImg = OtherImg.whale;
        public static boolean useMouseMoveAnim = true;
        public static int mouseMoveUpdateTime = 50; //刷新周期毫秒单位
        public static Dimension mouseMoveImgSize = new Dimension(50, 50); //图片大小
        public static Dimension mouseMoveImgOffset = new Dimension(-10, 0); //修正图片偏移
        //Table
        public static int tableMaxRowCount = 35; //默认表格的最大行
        public static int tableDefaultColCount = 5; //默认列数
        /*
        程序功能
        */
        //是否启用空行覆盖,如果启用，当点击保存时或表格被自动保存,表格中夹杂空行时会挪移下方的数据将它覆盖
        public static boolean enableOverwriteEmptyRows = true;
        //是否开启自动保存,如果开启,当切换表格或退出程序时不会显示是否选择的弹窗
        public static boolean enableAutoSave = false;
    }
}
